package com.pipi.biyesheji.enums;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * All rights Reserved, Designed By www.maihaoche.com
 *
 * @Package com.zj.dorm.core.enums
 * @author: 皮皮（pipi@maihaoche.com）
 * @date: 2019/3/30 12:04 PM
 * @Copyright: 2017-2020 www.maihaoche.com Inc. All rights reserved.
 * 注意：本内容仅限于卖好车内部传阅，禁止外泄以及用于其他的商业目
 */
@AllArgsConstructor
public enum BooleanEnum {

    NO(0, "否", "女", "禁用"),
    YES(1, "是", "男", "启用");

    @Getter
    private Integer code;

    @Getter
    private String desc;

    @Getter
    private String genderDesc;

    @Getter
    private String collegeStatus;

    public static String getDescByCode(Integer code) {
        if (null != code) {
            com.pipi.biyesheji.enums.BooleanEnum[] values = com.pipi.biyesheji.enums.BooleanEnum.values();
            for (com.pipi.biyesheji.enums.BooleanEnum value : values) {
                if (value.getCode().equals(code)) {
                    return value.getDesc();
                }
            }
        }
        return null;
    }

    public static String getGenderDescByCode(Integer code) {
        if (null != code) {
            BooleanEnum[] values = BooleanEnum.values();
            for (BooleanEnum value : values) {
                if (value.getCode().equals(code)) {
                    return value.getGenderDesc();
                }
            }
        }
        return null;
    }

    public static Map<Integer, String> getGenderMap() {
        Map<Integer, String> genderMap = Maps.newHashMap();
        BooleanEnum[] values = BooleanEnum.values();
        for (BooleanEnum value : values) {
            genderMap.put(value.getCode(), value.getGenderDesc());
        }
        return genderMap;
    }
}
